#include <cstdio>
#include <bitset>
using namespace std;
int read(){
	char c=getchar();int x=0;
	while(c<48||c>57) c=getchar();
	do x=(x<<1)+(x<<3)+(c^48),c=getchar();
	while(c>=48&&c<=57);
	return x;
}
const int N=10000003,P=998244353;
typedef long long ll;
int n,k;
int fac[N],fiv[N];
int qp(int a,int b=P-2){
	int res=1;
	while(b){
		if(b&1) res=(ll)res*a%P;
		a=(ll)a*a%P;b>>=1;
	}
	return res;
}
int arr[N];
bitset<N> vis;
int p[N],rk;
int main(){
	freopen("length.in","r",stdin);
	freopen("length.out","w",stdout);
	n=read();k=read();
	fac[0]=1;
	for(int i=1;i<=n;++i) fac[i]=(ll)fac[i-1]*i%P;
	fiv[n]=qp(fac[n]);
	for(int i=n;i;--i) fiv[i-1]=(ll)fiv[i]*i%P;
	arr[1]=1;
	for(int i=2;i<=n;++i){
		if(!vis[i]) arr[p[++rk]=i]=qp(i,k%(P-1)); 
		for(int j=1;j<=rk;++j){
			int cur=i*p[j];
			if(cur>n) break;
			vis.set(cur);
			arr[cur]=(ll)arr[i]*arr[p[j]]%P;
		}
	}
	int res=0,pw=1;
	for(int i=n;i;--i){
		res=(res+(ll)fac[n]*fiv[i]%P*fiv[n-i]%P*fac[i-1]%P*pw%P*arr[i]%P)%P;
		pw=(ll)pw*n%P;
	}
	printf("%d\n",res);
	return 0;
}
